﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ebullition
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] Sum = { 1, 8, 5, 17, 21, 10, 26 };
            Sort(Sum);//调用自定义方法Sort输出冒泡排序后的数组成员
            string[] firstNames = { "yuz", "余振", "余", "振" };
              Console.WriteLine("正常顺序输出用户名：");
            for (int i = 0; i < firstNames.Length; i++)
                Console.WriteLine("Name:{0}\t", firstNames[i]);
            Console.WriteLine("\n");
            Array.Clear(firstNames, 1, 3);
            Console.WriteLine("输出除房大伟以外的用户名：");
            for (int i = 0; i < firstNames.Length; i++)
                Console.WriteLine("Name:{0}\t", firstNames[i]);
            Console.WriteLine("\n");

        }
        static void Sort(int[] list)//数组作为参数
        {
            int i, j, temp;
            bool done = false;
            j = 1;
            while ((j < list.Length) && (!done))//判断长度
            {
                done = true;
                for (i = 0; i < list.Length - j; i++)
                {
                    if (list[i] > list[i + 1])
                    {
                        done = false;
                        temp = list[i];
                        list[i] = list[i + 1];//交换数据
                        list[i + 1] = temp;
                    }
                }
                j++;
            }
            Console.Write("\n排序结果如下：\n");
            for (int d = 0; d < list.Length; d++)
                Console.Write(list[d]+"\n");
            Console.Write("\n\n");
        }
    }
}
